package com.dgut.edu.cn.design.mode.filterchain.filter;

import com.dgut.edu.cn.design.mode.filterchain.dto.PriceCompareResult;
import com.dgut.edu.cn.design.mode.filterchain.dto.RuleFilterResVo;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @description:
 * @author: hongbin.zheng
 * @create: 2023-08-10 18:49
 **/
@Service
public class MpRuleFilter implements RuleFilter<PriceCompareResult> {

	@Override
	public RuleFilterResVo doFilter(PriceCompareResult priceCompareResult) throws Exception{

		if ((byte) 0 == priceCompareResult.getIsMp()) {
			// 非MP ，则过滤
			return RuleFilterResVo.fail(" 非MP ，则过滤", name());
		}
		return RuleFilterResVo.ok(name());
	}

	@Override
	public String name() {
		return "mpRuleFilter";
	}
}
